SPB Git forge

spb/rareindex

Public
54commits 1branches 0releases
7.1 MBsize
maindefault branch
10 days agolast push
TypeScript 61.9% HTML 37.2% SQL 0.7%
1.0 KB · 22 lines tsx
Raw Blame History
1'use client';23import { useActionState } from 'react';4import { addItemPhotoAction } from '@/lib/account/actions';5import { idle } from '@/lib/auth/state';6import { FormMessage, SubmitButton } from '@/components/account/form';78export function PhotoUploadForm({ itemId }: { itemId: string }) {9  const [state, action] = useActionState(addItemPhotoAction, idle);10  return (11    <form action={action} className="space-y-2">12      <input type="hidden" name="itemId" value={itemId} />13      <FormMessage state={state} />14      <input type="file" name="files" accept="image/jpeg,image/png,image/webp" multiple capture="environment" className="block w-full text-xs text-muted file:mr-3 file:rounded-md file:border file:border-border file:bg-elevated file:px-3 file:py-1.5 file:text-xs file:font-medium file:text-fg" />15      <SubmitButton variant="secondary" pendingText="Uploading…">16        Upload photos17      </SubmitButton>18      <p className="text-[11px] text-subtle">JPEG/PNG/WebP up to 8 MB each. On mobile you can take a photo directly.</p>19    </form>20  );21}22